﻿@namespace BlazorFluentUI
@inherits FluentUIComponentBase
@typeparam TItem

@if (DoNotContainWithinFocusZone)
{
    <div class=@($"ms-OverflowSet{(Vertical ? " ms-OverflowSet--vertical" : "")} {ClassName}")
         style=@Style>
        @if (ItemTemplate != null && Items != null)
        {
            foreach (var item in Items)
            {
                <div @key=(GetKey!(item)) class="ms-OverflowSet-item"  style=@Style>@ItemTemplate(item)</div>
            }
        }
        @if (OverflowTemplate != null && OverflowItems != null && OverflowItems.Count() > 0)
        {
            <div class="ms-OverflowSet-overflowButton">
                @OverflowTemplate(this.OverflowItems)
            </div>

        }
        @*else if (OverflowTemplate == null && OverflowItems != null && OverflowItems.Count() > 0)
            {
                <BlazorFluentUI.OverflowSetInternal.DefaultOverflowButton OverflowItems="OverflowItems" />
            }*@
    </div>
}
else
{
    <div class=@($"ms-OverflowSet{(Vertical ? " ms-OverflowSet--vertical" : "")} {ClassName}") style="display: inline">
        <FocusZone ClassName=@($"ms-OverflowSet{(Vertical ? " ms-OverflowSet--vertical" : "")} {ClassName}")
                      Style=@Style
                      Direction=@(Vertical ? FocusZoneDirection.Vertical : FocusZoneDirection.Horizontal)
                      @ref=@focusZoneComponent>
            @if (ItemTemplate != null && Items != null)
            {
                foreach (var item in Items)
                {
            <div @key=(GetKey!(item)) class="ms-OverflowSet-item" style=@Style>@ItemTemplate(item) </div>
                }
            }
            @if (OverflowTemplate != null && OverflowItems != null && OverflowItems.Count() > 0)
            {
                <div class="ms-OverflowSet-overflowButton">
                    @OverflowTemplate(this.OverflowItems)
                </div>

            }
            @*else if (OverflowTemplate == null && OverflowItems != null && OverflowItems.Count() > 0)
                {
                    <BlazorFluentUI.OverflowSetInternal.DefaultOverflowButton OverflowItems="OverflowItems" />
                }*@

        </FocusZone>
    </div>
}
